package com.probox.common.entity.domain.wechat;

import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;

import java.io.Serializable;

import com.probox.common.core.enums.DataStatus;
import com.probox.common.core.enums.SendStatusEnum;
import com.probox.common.core.enums.WechatSendStatusEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import com.baomidou.mybatisplus.annotation.*;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.probox.common.core.annotation.Excel;

/**
 * 消息发送记录对象 wechat_message_list
 *
 * @author usoft
 * @date 2021-08-16
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("wechat_message_list")
@ApiModel(description = "消息发送记录")
public class WechatMessageList implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * $column.columnComment
     */
    //默认主键自增
    @TableId(value = "MESSAGE_UID", type = IdType.AUTO)
    private Long messageUid;

    /**
     * 平台ID
     */
    @Excel(name = "平台ID")
    @ApiModelProperty(value = "平台ID")
    private Long platformUid;

    /**
     * 业务编号，如订单编号
     */
    @Excel(name = "业务编号，如订单编号")
    @ApiModelProperty(value = "业务编号，如订单编号")
    private String bizNo;

    /**
     * 模板编号
     */
    @Excel(name = "模板编号")
    @ApiModelProperty(value = "模板编号")
    private String templateNo;

    /**
     * 模板标题
     */
    @Excel(name = "模板标题")
    @ApiModelProperty(value = "模板标题")
    private String templateTitle;

    /**
     * 会员ID
     */
    @Excel(name = "会员ID")
    @ApiModelProperty(value = "会员ID")
    private Long memberUid;

    /**
     * 会员openID
     */
    @Excel(name = "会员openID")
    @ApiModelProperty(value = "会员openID")
    private String memberOpenId;

    /**
     * 会员昵称
     */
    @Excel(name = "会员昵称")
    @ApiModelProperty(value = "会员昵称")
    private String memberNickName;

    /**
     * 消息内容
     */
    @Excel(name = "消息内容")
    @ApiModelProperty(value = "消息内容")
    private String messageBody;

    /**
     * 发送状态，1成功，其他失败
     */
    @Excel(name = "发送状态，1成功，其他失败")
    @ApiModelProperty(value = "发送状态，1成功，其他失败")
    private String sendStatus;

    /**
     * 发送结果
     */
    @Excel(name = "发送结果")
    @ApiModelProperty(value = "发送结果")
    private String messageResult;

    /**
     * 发送时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "发送时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "发送时间")
    private Date sendTime;

    /**
     * 发送人
     */
    @Excel(name = "发送人")
    @ApiModelProperty(value = "发送人")
    private Long sendUser;


    /**
     * 发送状态，1成功，其他失败
     */
    @TableField(exist = false)
    private String sendStatusStr;

    public String getSendStatusStr() {
        if (!WechatSendStatusEnum.succeed.getKey().equals(this.sendStatus)){
            return WechatSendStatusEnum.failed.getKey();
        }
        return sendStatus;
    }
}
